

function getParam(paramName) {
    paramValue = "", isFound = !1;
    if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
        arrSource = decodeURI(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
        while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
    }
    return paramValue == "" && (paramValue = null), paramValue
}

var search_key = getParam('key');

function search(){
    window.open('../search/index.html?key='+$('#search_val').val());
}


var imgsrc = function (data, key) {



    for (var i = 0; i < data.length; i++) {

        var current = data[i];

        current['qr'] = 'http://lepinapi.91qulepin.com//Content/qr/job-' + current.id + '.png';

        $.post(
            'http://lepinapi.91qulepin.com/home/wx_sdk_sh1',
            {
                page: 'pages/index/index',
                key: current.id
            }, function (data) {

            });

        if (current[key].indexOf('http') > -1) {
            data[i]['Logo'] = current[key].replace(/[\r\n]/g, "").replace(/[ ]/g, "").replace('["', '').replace('"]', '');
        } else {
            data[i]['Logo'] = 'http://lepinapi.91qulepin.com' + current[key].replace(/[\r\n]/g, "").replace(/[ ]/g, "").replace('["', '').replace('"]', '');
        }

    }
}

var vuemodel = new Vue({
    el: '#list',
    data: {
        Row: 0,
        listDate: []
    },
    methods: {
        toinfo: function (item) {
            window.open('../info/index.html?key=' + item.id);
        }
    }
});

$.get('http://lepinapi.91qulepin.com/AppView/Seach/190/AF131AB/', {
    jobName: search_key,
    size: 50
}, function (data) {
    console.log(data)

    imgsrc(data.listDate, 'logo');

    vuemodel.listDate = data.listDate;
    vuemodel.Row = data.Row;

});

$('nav ul li').each(function () {
    switch ($(this).attr('data-type')) {
        case 'search':
            $(this).click(function () {
                window.open('../search/index.html');
            });
            break;
        case 'r_job':
            $(this).click(function () {
                window.open('../r_job/index.html');
            });
            break;
        case 'info':
            $(this).click(function () {
                window.open('../news/index.html');
            });
            break;
        case 'my':
            $(this).click(function () {
                window.open('../my/index.html');
            });
            break;
        case 'home':
            $(this).click(function () {
                window.open('../main/index.html');
            });
            break;
    }
});
